//
//  DrawCornerVC.m
//  BezierDemo
//
//  Created by 申元江 on 2018/12/27.
//  Copyright © 2018 yuanjiang. All rights reserved.
//

#import "DrawCornerVC.h"

@interface DrawCornerVC ()
@property (weak, nonatomic) IBOutlet UIView *blueView;
@property (weak, nonatomic) IBOutlet UIView *greenView;

@end

@implementation DrawCornerVC

- (void)viewDidLoad {
    [super viewDidLoad];
    
    
    UIRectCorner blueCorner = UIRectCornerTopLeft | UIRectCornerTopRight;
    UIBezierPath *bPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, self.blueView.frame.size.width, self.blueView.frame.size.height) byRoundingCorners:blueCorner cornerRadii:CGSizeMake(20, 20)];
    CAShapeLayer *bShapeLayer = [CAShapeLayer layer];
    bShapeLayer.strokeColor  = [UIColor clearColor].CGColor;
    bShapeLayer.fillColor =self.blueView.backgroundColor.CGColor;
    bShapeLayer.path = bPath.CGPath;
    self.blueView.layer.mask = bShapeLayer;
    
    
    UIRectCorner greenCorner = UIRectCornerBottomLeft | UIRectCornerBottomRight;
    UIBezierPath *gPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, self.greenView.frame.size.width, self.greenView.frame.size.height) byRoundingCorners:greenCorner cornerRadii:CGSizeMake(20, 20)];
    CAShapeLayer *gShapeLayer = [CAShapeLayer layer];
    gShapeLayer.strokeColor  = [UIColor clearColor].CGColor;
    gShapeLayer.fillColor =self.greenView.backgroundColor.CGColor;
    gShapeLayer.path = gPath.CGPath;
    self.greenView.layer.mask = gShapeLayer;
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
